public class OnlyTeamLeaderCanUpdateEngineerHandler implements Triggers.handler{
    public void handle(){
        List<Case> triggernew = (List<Case>) Trigger.new;
        Map<Id,Case> triggeroldmap = (Map<Id,Case>)Trigger.oldMap;
        Profile admin =  [select Id from Profile where Name = '系统管理员' or name='System Administrator' limit 1 ];
        Profile service =  [select Id from Profile where Name = '呼叫中心服务专员' limit 1 ];
        Profile assistant = [select Id from Profile where Name ='销售管理部助理' limit 1];
        for(Case ca: triggernew){
            Case oldca = triggeroldmap.get(ca.Id);
            if(ca.Engineer__c!=oldca.Engineer__c && ca.User__c!=UserInfo.getUserId() 
               && UserInfo.getProfileId()!=admin.Id && UserInfo.getProfileId() != service.Id
               && UserInfo.getProfileId() != assistant.Id && UserInfo.getProfileId() != ca.OwnerId){
                ca.addError(System.Label.Err_AssignEngineer);
            }
        }
    }
}